﻿#region Header

/*
Remote views based on linq
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System;
using System.Collections.Generic;

#endregion

namespace Sebastof.Services.Interfaces {
	/// <summary>
	/// Is responsible
	/// - for locating of metadata for an object
	/// - for storing of metadata for an object
	/// - to decide if metadata are available for a given object
	/// Whereas multiple metadata can be stored per object. They are identified by
	/// a string based key.
	/// </summary>
	public interface IMetadataLocatorService {
		#region Public Methods

		/// <summary>
		/// returns if metadata are available for the given object
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		bool HasMetadata(object key);

		/// <summary>
		/// returns if metadata are available for the given object and key
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		bool HasMetadata(object key, string metaDataKey);

		/// <summary>
		/// returns the metadata for the given object and key
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		T GetMetadata<T>(object key, string metaDataKey);

		/// <summary>
		/// returns the metadata for the given object and key
		/// if not available, the default value is returned
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		T GetMetadata<T>(object key, string metaDataKey, T defaultValue);

		/// <summary>
		/// returns all metadata for the given object
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		KeyValuePair<string, Object>[] GetMetadata(object key);

		/// <summary>
		/// set the metadata for the given object and key
		/// </summary>
		/// <param name="key"></param>
		/// <param name="metaDataKey"></param>
		/// <param name="value"></param>
		void SetMetadata(object key, string metaDataKey, object value);

		/// <summary>
		/// Overrites the local metadata with the metadata available in the given <see cref="MetadataContext"/>
		/// </summary>
		/// <param name="context"></param>
		void OverwriteMetadataWith(IMetadataLocatorService context);

		/// <summary>
		/// Overrites the local metadata with the metadata available in the given <see cref="MetadataContext"/>
		/// </summary>
		/// <param name="context"></param>
		void Add(IMetadataLocatorService service, object key);

		/// <summary>
		/// adds a object value for the given object key and metadatakey
		/// </summary>
		/// <param name="key"></param>
		/// <param name="metaDataKey"></param>
		/// <param name="value"></param>
		void Add(object key, string metaDataKey, object value);

		/// <summary>
		/// Returned all stored objects that contains metadata
		/// </summary>
		/// <returns></returns>
		IList<object> GetAllObjects();

		/// <summary>
		/// Returns a list of all stored objects that contains metadata
		/// for that a dictionary of them metadarta
		/// </summary>
		/// <returns></returns>
		Dictionary<object, Dictionary<string, object>> GetMetadataContext();

		#endregion
	}
}